package com.huawei.appmarket.support.launcher;

import android.content.Context;
import android.content.Intent;
import androidx.annotation.NonNull;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.updatesdk.service.otaupdate.UpdateStatusCode.DialogButton;
import o.AccountBussinessListener;
import o.ccp;
import o.ceg;
import o.dky.j;
import o.Logger;
import o.eod;
import o.eoj;
import o.evk;

public class HwIDCustomInterceptor extends HwIDDefaultInterceptor {

    static class e implements AccountBussinessListener {
        private Context ˊ;
        private String ˋ;
        private ceg ˎ;
        private Intent ˏ;
        private String ॱ;

        public e(@NonNull Context context, @NonNull Intent intent, @NonNull String str, @NonNull String str2, ceg o_ceg) {
            this.ॱ = str;
            this.ˎ = o_ceg;
            this.ˋ = str2;
            this.ˊ = context;
            this.ˏ = intent;
        }

        public void onAccountBusinessResult(ccp o_ccp) {
            if (102 == o_ccp.ˎ) {
                boolean launchByPackage;
                Logger.ˎ("AppLauncher", "login success for launching package:[" + this.ॱ + "],launcherInterceptor=" + this.ˎ);
                if (this.ˎ != null) {
                    launchByPackage = this.ˎ.launchByPackage(this.ˊ, this.ˏ, this.ॱ, this.ˋ);
                } else {
                    launchByPackage = false;
                }
                if (!launchByPackage) {
                    evk.ˏ(this.ˊ.getResources().getString(j.ˋ, new Object[]{this.ˋ}));
                }
            } else if (DialogButton.CONFIRM == o_ccp.ˎ) {
                Logger.ˋ("AppLauncher", "error after login for launching package:[" + this.ॱ + "]");
            }
            eoj.ˋ().ˊ("HwIDCustomInterceptor");
        }
    }

    public boolean launchByPackage(@NonNull Context context, Intent intent, @NonNull String str, String str2) {
        if (UserSession.getInstance().isLoginSuccessful() && eod.ˋ(context)) {
            Logger.ˎ("HwIDCustomInterceptor", "isLoginSuccessful=true");
            return super.launchByPackage(context, intent, str, str2);
        }
        Logger.ˎ("HwIDCustomInterceptor", "isLoginSuccessful=false");
        eoj.ˋ().ˎ("HwIDCustomInterceptor", new e(context, intent, str, str2, this));
        eod.ॱ(context);
        return true;
    }
}
